home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / strcspn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  372 b   |  28 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #undef strcspn
  6.  
  7. size_t strcspn(const char *s1, const char *s2)
  8.  
  9. {
  10.   size_t i;
  11.   const unsigned char *c1;
  12.   const unsigned char *c2;
  13.  
  14.   c1=s1;
  15.   for(i=0;;i++)
  16.     {
  17.       c2=s2;
  18.       do
  19.     {
  20.       if(c1[i]==*c2)
  21.         {
  22.           return i;
  23.         }
  24.     }
  25.       while(*c2++!='\0');
  26.     }
  27. }
  28.